package com.mt.roll.wms.controller;

import com.mt.roll.core.base.BaseController;
import com.mt.roll.core.constants.CommonConstant;
import com.mt.roll.core.dal.entity.WorkOrderExecute;
import com.mt.roll.core.params.IdParam;
import com.mt.roll.core.validator.groups.PageGroup;
import com.mt.roll.core.vo.PageVo;
import com.mt.roll.core.vo.R;
import com.mt.roll.wms.params.WorkOrderExecuteQueryParam;
import com.mt.roll.wms.service.WorkOrderExecuteService;
import com.mt.roll.wms.vo.WorkOrderExecuteVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.groups.Default;

/**
 * @Author weihongyang
 * @Date 2021/10/29 3:09 下午
 * @Version 1.0
 */
@RestController
@RequestMapping(CommonConstant.API_MODULE_WMS + "work/order/execute")
@Slf4j
@Api(value = "工单执行信息", tags = "工单执行信息", hidden = false)
public class WorkOrderExecuteController extends BaseController {
    
    @Autowired
    private WorkOrderExecuteService workOrderExecuteService;

    @PostMapping(value = "page")
    @ApiOperation(value = "获取分页工单")
    private R<PageVo<WorkOrderExecute>> page(@Validated({PageGroup.class, Default.class}) @RequestBody WorkOrderExecuteQueryParam workOrderExecuteQueryParam) {
        return workOrderExecuteService.page(workOrderExecuteQueryParam);
    }

    @PostMapping(value = "get")
    @ApiOperation(value = "获取工单详情")
    private R<WorkOrderExecute> get(@Validated @RequestBody IdParam idParam) {
        return workOrderExecuteService.get(idParam);
    }

}